import { Controller } from "../../mvc/core/Controller";
import { DataEvent } from "../events/DataEvent";
import { ENpcEffect } from "../../../Message/Public/ENpcEffect";
import { AIManager } from "../scene/ai/AIManager";
import { AIType } from "../scene/ai/AIType";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { Alert } from "../../../com/mui/controls/Alert";
import { Language } from "../../../extend/language/Language";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
import { ShopRule } from "../rules/ShopRule";
import { UpdateCode } from "../../component/gconst/UpdateCode";
import { RuneFeedWindow } from "../view/skill/rune/RuneFeedWindow";
import { IView } from "../../mvc/interfaces/IView";
import { SkillModule } from "../../../modules/SkillModule";
import { WindowEvent } from "../../component/window/WindowEvent";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
import { RolePlayer } from "../scene/player/entity/RolePlayer";
import { PlayerEvent } from "../scene/events/PlayerEvent";
import { SActiveToClient } from "../../../Message/Public/SActiveToClient";
import { JSONHelper } from "../../../com/mui/serialization/json/JSONHelper";
import { SkillHintIcon } from "../view/skill/SkillHintIcon";
import { UiHintIconView } from "../view/uiIconBtn/UiHintIconView";
import { EffectManager } from "../manager/EffectManager";
import { UIIconEvent } from "../view/uiIconBtn/UIIconEvent";
import { GameProxy } from "../mvc/GameProxy";
import { ECareer } from "../../../Message/Public/ECareer";
import { ISkillModule } from "../../../modules/interfaces/ISkillModule";
import { SkillInfo } from "../model/SkillInfo";
import { SoundManager } from "../../common/sound/SoundManager";
import { SoundTypeConst } from "../../common/sound/SoundTypeConst";
import { Log } from "../../../com/gengine/debug/Log";
import { SystemSetter } from "../view/system/SystemSetter";
import { LadderBattlefieldUtil } from "../view/ladderBattlefield/LadderBattlefieldUtil";
import { CareerUtil } from "../view/common/util/CareerUtil";
import { RuneBtn } from "../view/skill/rune/guide/RuneBtn";
import { SkillRules } from "../rules/SkillRules";
import { Game } from "../Game";
import { GuideTipsManager } from "../manager/GuideTipsManager";
import { SPlayerRuneInfo } from "../../../Message/Game/SPlayerRuneInfo";
import { RuneData } from "../view/skill/rune/data/RuneData";
import { MsgManager } from "../manager/MsgManager";
import { RuneFeedData } from "../view/skill/rune/data/RuneFeedData";
import { ItemData } from "../resource/info/ItemData";
import { SkillRuneComposeWin } from "../view/skill/rune/compose/SkillRuneComposeWin";
import { DataProvider } from "../../../fl/data/DataProvider";
import { SkillRuneHandbookTabData } from "../view/skill/rune/compose/SkillRuneHandbookTabData";
import { RuneManualConfig } from "../resource/RuneManualConfig";
import { RuneGuidePanel } from "../view/skill/rune/guide/RuneGuidePanel";
import { TRuneGuide } from "../../../Message/Db/Tables/TRuneGuide";
import { SkillRuneHandbookWin } from "../view/skill/rune/handbook/SkillRuneHandbookWin";
import { SkillRuneComposeConfirmWin } from "../view/skill/rune/compose/SkillRuneComposeConfirmWin";
import { LoaderHelp } from "../../common/display/LoaderHelp";
import { ResFileConst } from "../resource/ResFileConst";
import { RuneGetWindow } from "../view/skill/rune/runeGet/RuneGetWindow";
import { TweenMax } from "../../../com/greensock/TweenMax";
type int = number;
//class SkillController
    
    export  class SkillController extends Controller
    {
       

        /* internal  */winRetRuneRemovedHandler(arg1: Object /* flash.events.Event */): void
        {
            if (this._winGetRune == null) 
            {
                return;
            }
            this._winGetRune.removeEventListener(flash.events.Event.REMOVED_FROM_STAGE, this.winRetRuneRemovedHandler);
            this._winGetRune = null;
            return;
        }

        /* internal  */runeGetClickArenaHandler(arg1: DataEvent): void
        {
            var loc1=cache.scene.getNpcByEffect(ENpcEffect._ENpcEffectMeritExchange);
            AIManager.onAutoPathAIControl(loc1, AIType.AI_AutoPath);
            return;
        }

        /* internal  */runeGetClickGuildShopHandler(arg1: DataEvent): void
        {
            if (cache.guild.myGuildInfo) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GuildOpenShop, 3));
            }
            else 
            {
                Alert.okLabel = Language.getString(80271);
                Alert.buttonWidth = 70;
                Alert.show(Language.getStringByParam(80270, HTMLUtil.addColor(Language.getString(20195), "#ffff00")), Language.getString(20055), Alert.OK, null);
            }
            return;
        }

        /* internal  */runeGetClickShopMallHandler(arg1: DataEvent): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ShopMallShowToTab, ShopRule.ShopMallRune));
            return;
        }

        /* internal  */onSpecialActivityRewardShowMsg(arg1: DataEvent): void
        {
            var loc1=arg1.data.str as string;
            var loc2=arg1.data.code as int;
            if (loc2 == UpdateCode.EUpdateCodeRuneFeedActive && RuneFeedWindow.hasInstance()) 
            {
                if (!RuneFeedWindow.instance.isHide) 
                {
                    RuneFeedWindow.instance.showMsg(loc1);
                }
            }
            return;
        }

        protected /* override */ initView(): IView
        {
            var loc1=new SkillModule();
            loc1.addEventListener(WindowEvent.SHOW, this.onSkillModuleShow);
            loc1.addEventListener(WindowEvent.CLOSE, this.onSkillModuleClose);
            return loc1;
        }

        protected /* override */ initServer(): void
        {
            NetDispatcher.addCmdListener(ServerCommand.SkillListRes, this.onSkillListRes);
            NetDispatcher.addCmdListener(ServerCommand.SkillUpdate, this.onSkillUpdate);
            NetDispatcher.addCmdListener(ServerCommand.MoneyUpdate, this.updateCondition);
            NetDispatcher.addCmdListener(ServerCommand.RoleExpUpdate, this.updateCondition);
            NetDispatcher.addCmdListener(ServerCommand.RoleCareerUpdate, this.onRoleCareerUpdate);
            NetDispatcher.addCmdListener(ServerCommand.RoleCareerEnableUpdate, this.onRoleCareerTransform);
            NetDispatcher.addCmdListener(ServerCommand.SkillBaseRes, this.onSkillBaseRes);
            NetDispatcher.addCmdListener(ServerCommand.SkillGuildLearned, this.onSkillGuildUpdate);
            NetDispatcher.addCmdListener(ServerCommand.SkillMarryLearned, this.onSkillMarryUpdate);
            NetDispatcher.addCmdListener(ServerCommand.SkillMarryRmoved, this.onSkillMarryRmoved);
            RolePlayer.instance.addEventListener(PlayerEvent.RoleLevelUpdate, this.roleLevelUpdate);
            Dispatcher.addEventListener(EventName.GetSkillBook, this.onGetSkillBook);
            Dispatcher.addEventListener(EventName.SysSettingRes, this.onSysSettingRes);
            Dispatcher.addEventListener(EventName.Guide_SkillLearn, this.onGuideSkillLearnHandler);
            Dispatcher.addEventListener(EventName.skillLearnReq, this.onSkillLearnReq);
            Dispatcher.addEventListener(EventName.skillUpgrateAllReq, this.onSkillUpgrateAllReq);
            Dispatcher.addEventListener(EventName.skillUpgradeReq, this.onSkillUpGradeReq);
            NetDispatcher.addCmdListener(ServerCommand.SkillFishLeared, this.onSkillFishLearedRes);
            Dispatcher.addEventListener(EventName.SkillTransferOver, this.onSkillTransferOverRes);
            NetDispatcher.addCmdListener(ServerCommand.SkillXPLearned, this.onSkillXPLearedRes);
            Dispatcher.addEventListener(EventName.SkillBaseLearnReq, this.onSkillBaseLearnReq);
            Dispatcher.addEventListener(EventName.SkillActiveReq, this.onSkillActiveReq);
            NetDispatcher.addCmdListener(ServerCommand.BackpackDataChange, this.onBackpackUpdate);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.onBackpackUpdate);
            NetDispatcher.addCmdListener(ServerCommand.RunePackDataChange, this.onRunepackUpdate);
            NetDispatcher.addCmdListener(ServerCommand.RunePackItemsChange, this.onRunepackUpdate);
            NetDispatcher.addCmdListener(ServerCommand.RuneEffectAtrrUpdate, this.onRuneEffectUpdate);
            NetDispatcher.addCmdListener(ServerCommand.RuneCritGrowthAdd, this.onRuneCritGrowthAdd);
            NetDispatcher.addCmdListener(ServerCommand.RuneGrowthAdd, this.onRuneGrowthAdd);
            NetDispatcher.addCmdListener(ServerCommand.RuneLevelUp, this.onRuneLevelUp);
            NetDispatcher.addCmdListener(ServerCommand.RunePlayerRuneInfoCommand, this.onRuneInfo);
            NetDispatcher.addCmdListener(ServerCommand.BackpackDataChange, this.holyRuneListUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.holyRuneListUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.RunePackDataChange, this.holyRuneListUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.RunePackItemsChange, this.holyRuneListUpdateHandler);
            Dispatcher.addEventListener(EventName.RuneInsert, this.onRuneInsert);
            Dispatcher.addEventListener(EventName.RuneRemove, this.onRuneRemove);
            Dispatcher.addEventListener(EventName.RuneFeed, this.onRuneFeed);
            Dispatcher.addEventListener(EventName.RuneOpenFeedWindow, this.onRuneOpenFeedWindow);
            Dispatcher.addEventListener(EventName.RuneOpenRuneWindow, this.onRuneOpenRuneWindow);
            Dispatcher.addEventListener(EventName.RuneSelect, this.onRuneSelect);
            Dispatcher.addEventListener(EventName.RuneOpenExtra, this.onRuneOpenExtra);
            Dispatcher.addEventListener(EventName.RuneShowRuneCompositionPanel, this.showRuneCompositonHandler);
            Dispatcher.addEventListener(EventName.RuneClickExpandRuneTypes, this.expandRuneHandbookTypeHandler);
            Dispatcher.addEventListener(EventName.RuneClickShrinRuneTypes, this.shrinRuneHandbookTypeHandler);
            Dispatcher.addEventListener(EventName.RuneClickRuneSubTypes, this.expandRuneHandbookSubTypeHandler);
            Dispatcher.addEventListener(EventName.RuneClickShowMyHolyRune, this.clickShowMyHolyRuneHandler);
            Dispatcher.addEventListener(EventName.RuneClickHolySwallowRune, this.clickHolySwallowRuneHandler);
            Dispatcher.addEventListener(EventName.RuneConfirmSwallow, this.swallowRuneConfirmed);
            Dispatcher.addEventListener(EventName.RuneMyHolyCategoryIndexChanged, this.myHolyRuneCategoryChangedHandler);
            Dispatcher.addEventListener(EventName.RuneShowRuneHandbook, this.showRuneHandbookHandler);
            Dispatcher.addEventListener(EventName.RuneGuideBtnClick, this.onRuneGuideHandler);
            Dispatcher.addEventListener(EventName.RuneGuideGetItem, this.onRuneGuideGetItemHandler);
            NetDispatcher.addCmdListener(ServerCommand.RoleNewEnergyUpdate, this.onRoleNewEnergyUpdate);
            Dispatcher.addEventListener(EventName.RuneGetShowGetWin, this.showRuneGetWinHandler);
            Dispatcher.addEventListener(EventName.RuneGetArena, this.runeGetClickArenaHandler);
            Dispatcher.addEventListener(EventName.RuneGetGuildShop, this.runeGetClickGuildShopHandler);
            Dispatcher.addEventListener(EventName.RuneGetShopMall, this.runeGetClickShopMallHandler);
            NetDispatcher.addCmdListener(ServerCommand.ActiveRuneFeedOneKey, this.onActiveRuneFeedOneKey);
            NetDispatcher.addCmdListener(ServerCommand.ActiveRuneFeedOneKeyTimes, this.onActiveRuneFeedOneKeyTimes);
            return;
        }

        /* internal  */onActiveRuneFeedOneKeyTimes(arg1: Object): void
        {
            if (!RuneFeedWindow.instance.isHide) 
            {
                RuneFeedWindow.instance.updateActiveBtn();
            }
            return;
        }

        /* internal  */onActiveRuneFeedOneKey(arg1: Object): void
        {
            var loc1=arg1 as SActiveToClient;
            var loc2=loc1.modulus;
            var loc3;
            if ((loc3 = JSONHelper.deserialize(loc2)) == null) 
            {
                return;
            }
            if (loc3.hasOwnProperty("cost")) 
            {
                cache.skill.activeRuneFeed.cost = loc3["cost"];
            }
            if (loc3.hasOwnProperty("times")) 
            {
                cache.skill.activeRuneFeed.times = loc3["times"];
            }
            if (loc3.hasOwnProperty("value")) 
            {
                cache.skill.activeRuneFeed.value = loc3["value"];
            }
            if (!RuneFeedWindow.instance.isHide) 
            {
                RuneFeedWindow.instance.updateActiveBtn();
            }
            return;
        }

        public get hintIcon(): SkillHintIcon
        {
            return this._skillHintIcon;
        }

        public showHintIcon(): void
        {
            if (cache.guide.skillLearnAlert == true) 
            {
                this.hideHintIcon();
                return;
            }
            if (cache.guide.guideSkillLearn == true) 
            {
                this.hideHintIcon();
                return;
            }
            if (_view && !_view.isHide) 
            {
                return;
            }
            if (!this._skillHintIcon) 
            {
                this._skillHintIcon = new SkillHintIcon();
            }
            this._skillHintIcon.show();
            UiHintIconView.instance.addHintIcon(this._skillHintIcon);
            return;
        }

        public hideHintIcon(): void
        {
            if (this._skillHintIcon) 
            {
                if (this._skillHintIcon.parent) 
                {
                    this._skillHintIcon.parent.removeChild(this._skillHintIcon);
                    EffectManager.glowFilterUnReg(this._skillHintIcon);
                    this._skillHintIcon.dispatchEvent(new UIIconEvent(UIIconEvent.RemoveIcon));
                }
            }
            return;
        }

        /* internal  */onSkillLearnReq(arg1: DataEvent): void
        {
            flash.utils.clearTimeout(this._timerKey);
            this._learnReq = true;
            flash.utils.setTimeout(this.onTimerOutHandler, 1000);
            GameProxy.skillProxy.skillLearnReq(arg1.data as int);
            return;
        }

        /* internal  */onSkillUpgrateAllReq(arg1: DataEvent): void
        {
            GameProxy.skillProxy.skillUpgrateAllReq();
            return;
        }

        /* internal  */onSkillUpGradeReq(arg1: DataEvent): void
        {
            flash.utils.clearTimeout(this._timerKey);
            this._learnReq = true;
            flash.utils.setTimeout(this.onTimerOutHandler, 1000);
            GameProxy.skillProxy.skillUpgradeReq(arg1.data as int);
            return;
        }

        /* internal  */onTimerOutHandler(): void
        {
            this._learnReq = false;
            return;
        }

        /* internal  */onSkillBaseLearnReq(arg1: DataEvent): void
        {
            GameProxy.skillProxy.skillLearnReq(int(arg1.data));
            return;
        }

        /* internal  */onSkillActiveReq(arg1: DataEvent): void
        {
            GameProxy.skillProxy.activateSeniorCareerSkill();
            return;
        }

        /* internal  */onSkillListRes(arg1: Array<any>): void
        {
            cache.skill.updateSkillRuneEffect();
            if (!(cache.role.roleInfo.career == ECareer._ECareerNo || cache.role.roleInfo.career == ECareer._ECareerNewPlayer)) 
            {
                if (_view != null) 
                {
                    (_view as ISkillModule).initSkill(arg1);
                }
                this.guideLevelUpAble();
            }
            return;
        }

        /* internal  */onSkillUpdate(arg1: SkillInfo): void
        {
            var loc1=null;
            cache.skill.updateSkillRuneEffect(arg1);
            this._learnReq = false;
            cache.guide.skillLearnAlert = false;
            SoundManager.instance.soundPlay(SoundTypeConst.LearnSkill);
            if (arg1.position <= 2 && arg1.learned && arg1.tSkill.skillLevel == 1) 
            {
                Log.error("自动释放技能Log，SkillController: onSkillUpdate");
                arg1.autoUse = true;
                SystemSetter.localSetter.skillIdDic[arg1.position] = 1;
                loc1 = SystemSetter.localSetter.getString();
                Dispatcher.dispatchEvent(new DataEvent(EventName.Sys_SaveInfoNotShowInWindow, loc1));
            }
            this.guideLevelUpAble();
            this.guideLevelUp(false);
            if (_view != null) 
            {
                (_view as ISkillModule).updateSkill(arg1);
            }
            if (cache.skill.skillLearnAble.length == 0 && cache.role.roleInfo.level < 50) 
            {
                if (isViewShow) 
                {
                    _view.hide();
                }
            }
            return;
        }

        /* internal  */onSkillGuildUpdate(arg1: SkillInfo): void
        {
            if (isViewShow) 
            {
                (_view as ISkillModule).updateSkillGuild(arg1);
            }
            return;
        }

        /* internal  */onSkillMarryUpdate(arg1: SkillInfo): void
        {
            if (isViewShow) 
            {
                (_view as ISkillModule).updateSkillMarry(arg1);
            }
            else if (arg1.skillLevel == 1 && !cache.guide.guideMarrySkill) 
            {
                cache.guide.guideMarrySkill = true;
                Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_SkillMarryLeared, arg1));
            }
            if (cache.shortCuts.jstr != null) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.AddToShortcutsByReq, arg1));
            }
            return;
        }

        /* internal  */onSkillMarryRmoved(arg1: Object=null): void
        {
            if (_view) 
            {
                (_view as ISkillModule).refreshMarrySkill();
            }
            return;
        }

        /* internal  */onBackpackUpdate(arg1: Object): void
        {
            if (isViewShow) 
            {
                (_view as ISkillModule).updateBackpackRune();
            }
            if (RuneFeedWindow.hasInstance()) 
            {
                RuneFeedWindow.instance.updateMaterialNum();
                RuneFeedWindow.instance.updateBackPackData();
            }
            return;
        }

        /* internal  */updateCondition(arg1: Object): void
        {
            if (this._learnReq) 
            {
                return;
            }
            if (isViewShow) 
            {
                (_view as ISkillModule).updateCondition();
            }
            this.guideLevelUpAble();
            this.guideLevelUp();
            return;
        }

        /* internal  */roleLevelUpdate(arg1: PlayerEvent): void
        {
            this.updateCondition(null);
            return;
        }

        /* internal  */onGetSkillBook(arg1: DataEvent): void
        {
            this.guideLevelUpAble();
            this.guideLevelUp();
            return;
        }

        /* internal  */guideLevelUpAble(): void
        {
            cache.skill.updateLearnAble();
            if (cache.skill.skillLearnAble.length > 0) 
            {
                if (!LadderBattlefieldUtil.isInLadderBattlefield && cache.skill.skillLearnLevelChange() && cache.skill.skillLearnAbleChange()) 
                {
                    this.showHintIcon();
                }
            }
            else 
            {
                this.hideHintIcon();
            }
            return;
        }

        /* internal  */guideLevelUp(arg1: Boolean=true): void
        {
            if (_view && !_view.isHide) 
            {
                (_view as ISkillModule).guideLevelUp(cache.skill.skillLearnAble, arg1);
            }
            return;
        }

        /* internal  */onRoleCareerUpdate(arg1: Object): void
        {
            cache.skill.initCareerSkill(true);
            this.onSkillListRes(cache.skill.skillMaps);
            this.guideLevelUp();
            this.resetSkillAutoUse();
            this.refreshTabBar();
            if (CareerUtil.isGradeCareer(cache.role.careerEnabled) && !cache.role.hasSecondCareer) 
            {
                RuneBtn.getInstance().show();
            }
            return;
        }

        /* internal  */onRoleCareerTransform(arg1: Object): void
        {
            cache.skill.initCareerSkill(false);
            this.onSkillListRes(cache.skill.skillMaps);
            this.guideLevelUp();
            this.refreshTabBar();
            if (!(_view == null) && !_view.isHide) 
            {
                (_view as ISkillModule).updateRuneData();
                (_view as ISkillModule).initSkill(cache.skill.skillMaps);
            }
            return;
        }

        /* internal  */refreshTabBar(): void
        {
            if (_view != null) 
            {
                (_view as ISkillModule).refreshTabBar();
            }
            return;
        }

        /* internal  */resetSkillAutoUse(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc5=0;
            var loc6=SystemSetter.localSetter.skillIdDic;
            for (loc1 in loc6) 
            {
                SystemSetter.localSetter.skillIdDic[loc1] = 0;
            }
            loc2 = SystemSetter.localSetter.getString();
            Dispatcher.dispatchEvent(new DataEvent(EventName.Sys_SaveInfoNotShowInWindow, loc2));
            if (CareerUtil.isGradeCareer(cache.role.careerEnabled)) 
            {
                while (loc4 <= 1) 
                {
                    loc3 = cache.skill.skillMaps[loc4];
                    loc3.autoUse = true;
                    Log.error("自动释放技能Log，SkillController: resetSkillAutoUse");
                    SystemSetter.localSetter.skillIdDic[loc3.position] = 1;
                    ++loc4;
                }
                loc2 = SystemSetter.localSetter.getString();
                Dispatcher.dispatchEvent(new DataEvent(EventName.Sys_SaveInfoNotShowInWindow, loc2));
            }
            return;
        }

        /* internal  */onFightServerRes(arg1: DataEvent): void
        {
            var loc2=null;
            var loc1=int(arg1.data);
            if (SkillRules.isMarrySkillById(loc1)) 
            {
                if (isViewShow) 
                {
                    loc2 = cache.skill.getSkillInfoById(loc1);
                    if (loc2) 
                    {
                        (_view as ISkillModule).coolDownMarrySkill(loc2);
                    }
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.Skill_CoolDown, loc1));
            }
            return;
        }

        /* internal  */onSkillCoolDown(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            cache.skill.skillCoolDown(loc1, true);
            return;
        }

        /* internal  */onSkillCoolDownEnd(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            cache.skill.skillCoolDown(loc1, false);
            return;
        }

        /* internal  */onSkillBaseRes(arg1: Array<any>): void
        {
            if (_view != null) 
            {
                (_view as ISkillModule).initBaseSkill(arg1);
            }
            return;
        }

        /* internal  */onSkillFishLearedRes(arg1: SkillInfo): void
        {
            if (_view != null) 
            {
                (_view as ISkillModule).addBaseSkill(arg1);
            }
            return;
        }

        /* internal  */onSkillXPLearedRes(arg1: SkillInfo): void
        {
            if (_view != null) 
            {
                (_view as ISkillModule).addBaseSkill(arg1);
            }
            return;
        }

        /* internal  */onSysSettingRes(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=SystemSetter.currentSetter.skillIdDic;
            for (loc2 in loc4) 
            {
                loc1 = cache.skill.getSkillInfoByPosition(parseInt(loc2));
                if (loc1 == null) 
                {
                    continue;
                }
                loc1.autoUse = !(SystemSetter.currentSetter.skillIdDic[loc2] == 0);
            }
            return;
        }

        /* internal  */onGuideSkillLearnHandler(arg1: DataEvent): void
        {
            if (view.isHide) 
            {
                view.show();
            }
            else 
            {
                (view as ISkillModule).guideSkillLearn();
            }
            return;
        }

        /* internal  */onSkillTransferOverRes(arg1: DataEvent): void
        {
            var loc1=arg1.data as Object /* flash.geom.Point */;
            if (!(loc1 == null) && !(loc1.x == RolePlayer.instance.currentPoint.x) && !(loc1.y == RolePlayer.instance.currentPoint.y)) 
            {
                Game.scene.moveRole(loc1);
            }
            return;
        }

        /* internal  */onSkillModuleShow(arg1: WindowEvent): void
        {
            this.hideHintIcon();
            if (cache.guide.guideSkillLearn) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.SkillWindowShow));
                (_view as ISkillModule).guideSkillLearn();
            }
            if (cache.guide.guideMarrySkill) 
            {
                cache.guide.guideMarrySkill = false;
                GuideTipsManager.hideGuideTips();
                (_view as ISkillModule).changeTabBarByIndex(3);
            }
            if (_view != null) 
            {
                (view as ISkillModule).updateExtraNum(cache.rune.runeInfo);
            }
            return;
        }

        /* internal  */onSkillModuleClose(arg1: WindowEvent): void
        {
            if (cache.guide.guideSkillLearn) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.SkillWindowClose));
            }
            this.hideHintIcon();
            cache.skill.saveLastSkillLearnAble();
            return;
        }

        /* internal  */onRunepackUpdate(arg1: Object): void
        {
            if (_view && !_view.isHide) 
            {
                (_view as ISkillModule).updateRuneData();
            }
            if (RuneFeedWindow.hasInstance()) 
            {
                RuneFeedWindow.instance.updateRunePackData();
            }
            return;
        }

        /* internal  */onRuneEffectUpdate(arg1: Object): void
        {
            cache.skill.updateSkillRuneEffect();
            if (_view && !_view.isHide) 
            {
                (_view as ISkillModule).refreshSkill();
            }
            return;
        }

        /* internal  */onRuneCritGrowthAdd(arg1: int): void
        {
            RuneFeedWindow.instance.addGrowthEffect(arg1, true);
            return;
        }

        /* internal  */onRuneGrowthAdd(arg1: int): void
        {
            RuneFeedWindow.instance.addGrowthEffect(arg1);
            return;
        }

        /* internal  */onRuneLevelUp(arg1: Object): void
        {
            if (RuneFeedWindow.hasInstance()) 
            {
                RuneFeedWindow.instance.addLevelUpEffect();
            }
            return;
        }

        /* internal  */onRuneInfo(arg1: SPlayerRuneInfo): void
        {
            if (CareerUtil.isGradeCareer() && !cache.role.hasSecondCareer && arg1.runeGuide == 0) 
            {
                RuneBtn.getInstance().show();
            }
            else 
            {
                if (RuneBtn.hasInstance()) 
                {
                    RuneBtn.getInstance().hide();
                }
                if (this._winRuneGuide && !this._winRuneGuide.isHide) 
                {
                    this._winRuneGuide.hide();
                }
            }
            if (_view != null) 
            {
                (view as ISkillModule).updateExtraNum(arg1);
            }
            return;
        }

        /* internal  */holyRuneListUpdateHandler(arg1: Object): void
        {
            if (!this._winRuneCompose) 
            {
                return;
            }
            var loc1=String(arg1);
            this.runeComposeWinGotoIndex(this.winRuneCompose.getCurCategory(), this.winRuneCompose.getSelectedItemIndex());
            return;
        }

        /* internal  */onRuneInsert(arg1: DataEvent): void
        {
            var loc1=arg1.data as RuneData;
            if (cache.rune.runeInfo) 
            {
                if (loc1.pos > cache.rune.runeInfo.normalExtraNum && loc1.pos <= 4 || loc1.pos > 4 + cache.rune.runeInfo.skillExtraNum) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(44005));
                    return;
                }
            }
            else if (loc1.pos == 3 || loc1.pos == 4 || loc1.pos > 8) 
            {
                MsgManager.showRollTipsMsg(Language.getString(44005));
                return;
            }
            GameProxy.rune.equip(loc1.itemData.uid, loc1.pos);
            return;
        }

        /* internal  */onRuneRemove(arg1: DataEvent): void
        {
            var loc1=arg1.data.toString();
            GameProxy.rune.takeOff(loc1);
            return;
        }

        /* internal  */onRuneFeed(arg1: DataEvent): void
        {
            var loc1=arg1.data as RuneFeedData;
            GameProxy.rune.feedRune(loc1.posType, loc1.uid, loc1.materialLevel, loc1.materalNum, loc1.autoBuy, loc1.useBind, loc1.activeOneKey);
            return;
        }

        /* internal  */onRuneOpenFeedWindow(arg1: DataEvent): void
        {
            var loc1=null;
            RuneFeedWindow.instance.show();
            if (arg1.data) 
            {
                loc1 = arg1.data as ItemData;
                RuneFeedWindow.instance.setSelectItemData(loc1);
            }
            return;
        }

        /* internal  */onRuneOpenRuneWindow(arg1: DataEvent): void
        {
            if (CareerUtil.isGradeCareer()) 
            {
                (view as ISkillModule).changeToTabIndex(4);
                (view as ISkillModule).showPackRune();
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(44060));
            }
            return;
        }

        /* internal  */onRuneSelect(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            (view as ISkillModule).runeSelectIndex = loc1;
            return;
        }

        /* internal  */onRuneOpenExtra(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.rune.addRuneExtraNum(loc1);
            return;
        }

        /* internal  */showRuneCompositonHandler(arg1: DataEvent): void
        {
            this.winRuneCompose.show();
            this.runeComposeWinGotoIndex(SkillRuneComposeWin.Selected_All);
            return;
        }

        /* internal  */runeComposeWinGotoIndex(arg1: int, arg2: int=-1): void
        {
            var loc1=new DataProvider();
            var loc2=[];
            var loc4=arg1;
            switch (loc4) 
            {
                case SkillRuneComposeWin.Selected_All:
                {
                    loc2 = cache.rune.getMyAllHollyRunes();
                    break;
                }
                case SkillRuneComposeWin.Selected_Equiped:
                {
                    loc2 = cache.rune.getMyEquipedRuneFromRoleBackpack();
                    break;
                }
                case SkillRuneComposeWin.Selected_Backpack:
                {
                    loc2 = cache.rune.getMyHolyRuneFromBackpack();
                    break;
                }
                case SkillRuneComposeWin.Selected_ActivedAll:
                {
                    loc2 = cache.rune.getMyEffectAllActivedHolyRune();
                    break;
                }
                case SkillRuneComposeWin.Selected_ActivedPartly:
                {
                    loc2 = cache.rune.getMyEffectPartlyActivedHolyRune();
                    break;
                }
                default:
                {
                    break;
                }
            }
            var loc3=0;
            while (loc3 < loc2.length) 
            {
                loc1.addItem(loc2[loc3]);
                ++loc3;
            }
            this.winRuneCompose.updateMyHolyList(loc1);
            if (arg2 < 0) 
            {
                arg2 = 0;
            }
            if (arg2 >= loc2.length) 
            {
                arg2 = (loc2.length - 1);
            }
            this.winRuneCompose.updateCompose(loc2[arg2]);
            if (this.winRuneCompose.selectedIndex < 0) 
            {
                this.winRuneCompose.selectedIndex = 0;
            }
            return;
        }

        /* internal  */expandRuneHandbookTypeHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as SkillRuneHandbookTabData;
            this.winRuneHandbook.expandTab(loc1.type);
            this.runeHandbookUpdateCurSelected();
            return;
        }

        /* internal  */shrinRuneHandbookTypeHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as SkillRuneHandbookTabData;
            this.winRuneHandbook.shrinTab(loc1.type);
            return;
        }

        /* internal  */showRuneHandbookHandler(arg1: DataEvent): void
        {
            var loc5=null;
            var loc6=null;
            this.winRuneHandbook.show();
            if (this.winRuneHandbook.isCategoryInited) 
            {
                return;
            }
            var loc1=RuneManualConfig.instance.categoryTypes;
            var loc2=RuneManualConfig.instance.categoryNames;
            var loc3=[];
            var loc4=0;
            while (loc4 < loc1.length) 
            {
                loc5 = RuneManualConfig.instance.getSubNamesByType(loc1[loc4]);
                (loc6 = new SkillRuneHandbookTabData()).name = loc2[loc4];
                loc6.type = loc1[loc4];
                loc6.subNames = loc5;
                loc3.push(loc6);
                ++loc4;
            }
            this.winRuneHandbook.updateCategory(loc3);
            this.winRuneHandbook.customExpandCategory(0);
            this.runeHandbookUpdateCurSelected();
            return;
        }

        /* internal  */runeHandbookUpdateCurSelected(arg1: string=""): void
        {
            var loc1=this.winRuneHandbook.getCurCategoryType();
            var loc2=arg1;
            if (loc2 == "") 
            {
                loc2 = this.winRuneHandbook.getCurSubName();
            }
            if (loc2 == "") 
            {
                this.winRuneHandbook.setCurSubTab(0);
                loc2 = this.winRuneHandbook.getCurSubName();
            }
            var loc3=RuneManualConfig.instance.getRunesByType(loc1);
            var loc4=RuneManualConfig.instance.filterByName(loc3, loc2);
            this.winRuneHandbook.updateRightPartData(loc4);
            return;
        }

        /* internal  */expandRuneHandbookSubTypeHandler(arg1: DataEvent): void
        {
            var loc1=String(arg1.data);
            this.runeHandbookUpdateCurSelected(loc1);
            return;
        }

        /* internal  */clickShowMyHolyRuneHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as ItemData;
            this._winRuneCompose.updateCompose(loc1);
            return;
        }

        /* internal  */swallowRuneConfirmed(arg1: DataEvent): void
        {
            var loc4=null;
            var loc1=arg1.data["datas"] as Array<any>;
            var loc2=arg1.data["targetData"] as ItemData;
            if (loc1 == null || loc2 == null) 
            {
                return;
            }
            if (this.winComposeConfirm == null || this.winComposeConfirm.winPart1 == null || this.winComposeConfirm.winPart2 == null) 
            {
                return;
            }
            var loc3=new Map<any, any> /* flash.utils.Dictionary */();
            if (this.winComposeConfirm.winPart1.getCurSelectedIcon() != null) 
            {
                loc4 = this.winComposeConfirm.winPart1.getCurSelectedIcon().itemData;
                loc3[loc4.uid] = loc4.posType;
            }
            if (this.winComposeConfirm.winPart2.getCurSelectedIcon() != null) 
            {
                loc4 = this.winComposeConfirm.winPart2.getCurSelectedIcon().itemData;
                loc3[loc4.uid] = loc4.posType;
            }
            GameProxy.rune.swallowRune(loc2.posType, loc2.uid, loc3);
            return;
        }

        /* internal  */myHolyRuneCategoryChangedHandler(arg1: DataEvent): void
        {
            this.runeComposeWinGotoIndex(this.winRuneCompose.getCurCategory(), this.winRuneCompose.getSelectedItemIndex());
            return;
        }

        /* internal  */clickHolySwallowRuneHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data["stuffs"] as Array<any>;
            var loc2=arg1.data["targetData"] as ItemData;
            if (loc1 == null || loc2 == null) 
            {
                return;
            }
            this.winComposeConfirm.updateData(loc1[0] as ItemData, loc1[1] as ItemData, loc2);
            this.winComposeConfirm.show();
            return;
        }

        /* internal  */onRuneGuideHandler(arg1: DataEvent): void
        {
            if (!this._winRuneGuide) 
            {
                this._winRuneGuide = new RuneGuidePanel();
            }
            if (this._winRuneGuide.isHide) 
            {
                this._winRuneGuide.show();
            }
            return;
        }

        /* internal  */onRuneGuideGetItemHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as TRuneGuide;
            if (loc1) 
            {
                GameProxy.rune.runeGuideGet(loc1.itemCode);
            }
            return;
        }

        /* internal  */get winRuneHandbook(): SkillRuneHandbookWin
        {
            if (this._winRuneHandbook == null) 
            {
                this._winRuneHandbook = new SkillRuneHandbookWin();
            }
            return this._winRuneHandbook;
        }

        /* internal  */get winRuneCompose(): SkillRuneComposeWin
        {
            if (this._winRuneCompose == null) 
            {
                this._winRuneCompose = new SkillRuneComposeWin();
            }
            return this._winRuneCompose;
        }

        /* internal  */get winComposeConfirm(): SkillRuneComposeConfirmWin
        {
            if (this._winComposeConfirm == null) 
            {
                this._winComposeConfirm = new SkillRuneComposeConfirmWin();
            }
            return this._winComposeConfirm;
        }

        /* internal  */onRoleNewEnergyUpdate(arg1: Object): void
        {
            if (isViewShow) 
            {
                (view as ISkillModule).updateNewEnergy();
            }
            return;
        }

        /* internal  */showRuneGetWinHandler(arg1: DataEvent): void
        {
            LoaderHelp.addResCallBack(ResFileConst.runeGet, this.getRuneGetWinResHandler);
            return;
        }

        /* internal  */getRuneGetWinResHandler(): void
        {
            if (_view != null) 
            {
                (view as ISkillModule).showRuneGetWin();
            }
            return;
        }

        private /* var */_skillHintIcon: SkillHintIcon;

        private /* var */_winRuneHandbook: SkillRuneHandbookWin;

        private /* var */_winRuneCompose: SkillRuneComposeWin;

        private /* var */_winComposeConfirm: SkillRuneComposeConfirmWin;

        private /* var */_winRuneGuide: RuneGuidePanel;

        private /* var */_winGetRune: RuneGetWindow;

        private /* var */_tweenIn: TweenMax;

        private /* var */_learnReq: Boolean;

        private /* var */_timerKey: uint;
    }
